package cn.qayy.po;

import java.util.Date;

import cn.qayy.dto.ClientDTO;
import cn.qayy.utils.DateUtils;
import cn.qayy.utils.UUIDUtils;

/**
 * 
 * 
 * @author wangyu
 * 好伙伴实体
 * @date 2018-09-03
 */
public class WxClient {
    private Integer id;

    /**
     * 姓名
     */
    private String name;

    /**
     * 手机号
     */
    private String telephone;

    /**
     * 省份
     */
    private String province;

    /**
     * 地市
     */
    private String city;

    /**
     * 区县
     */
    private String country;

    /**
     * 入货乙方
     */
    private String terminalCollection;

    /**
     * openid
     */
    private String openid;

    /**
     * 用户类型
     */
    private String type;
    
    private String mtime=DateUtils.dateToString(new Date(),"yyyy/MM/dd HH:mm:ss");//更新时间
    
    private String ctime=DateUtils.dateToString(new Date(),"yyyy/MM/dd HH:mm:ss");//创建时间

    //验证码
    private String uuid="";
    
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone == null ? null : telephone.trim();
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province == null ? null : province.trim();
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city == null ? null : city.trim();
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country == null ? null : country.trim();
    }

    public String getTerminalCollection() {
        return terminalCollection;
    }

    public void setTerminalCollection(String terminalCollection) {
        this.terminalCollection = terminalCollection == null ? null : terminalCollection.trim();
    }

    public String getOpenid() {
        return openid;
    }

    public void setOpenid(String openid) {
        this.openid = openid == null ? null : openid.trim();
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type == null ? null : type.trim();
    }
    
	public String getMtime() {
		return mtime;
	}

	public void setMtime(String mtime) {
		this.mtime = mtime;
	}

	public String getCtime() {
		return ctime;
	}

	public void setCtime(String ctime) {
		this.ctime = ctime;
	}

	@Override
	public String toString() {
		return "WxClient [id=" + id + ", name=" + name + ", telephone=" + telephone + ", province=" + province
				+ ", city=" + city + ", country=" + country + ", terminalCollection=" + terminalCollection + ", openid="
				+ openid + ", type=" + type + "]";
	}

	public WxClient(Integer id, String name, String telephone, String province, String city, String country,
			String terminalCollection, String openid, String type) {
		super();
		this.id = id;
		this.name = name;
		this.telephone = telephone;
		this.province = province;
		this.city = city;
		this.country = country;
		this.terminalCollection = terminalCollection;
		this.openid = openid;
		this.type = type;
	}

	public WxClient() {
		super();
	}
    
	public String getUuid() {
		return uuid;
	}

	public void setUuid(String uuid) {
		this.uuid = uuid;
	}

	/**
	 * 通过DTO初始化
	 * @param dto
	 * @return
	 */
	public WxClient setByDTO(ClientDTO dto) {
		this.setTelephone(dto.getTelephone());
		this.setProvince(dto.getProvince());
		this.setCity(dto.getCity());
		this.setCountry(dto.getCountry());
		this.setTerminalCollection(dto.getTerminalCollection());
		this.setType(dto.getType());
		this.setName(dto.getName());
		return this;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((uuid == null) ? 0 : uuid.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		WxClient other = (WxClient) obj;
		if (uuid == null) {
			if (other.uuid != null)
				return false;
		} else if (!uuid.equals(other.uuid))
			return false;
		return true;
	}
}